﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>human_fileFo</title>
    <script src="~/lib/axios/dist/axios.js"></script>
    <script src="~/lib/vue/dist/vue.js"></script>
    <script src="~/lib/element-ui/lib/index.js"></script>
    <link href="~/lib/element-ui/lib/theme-chalk/index.css" rel="stylesheet" />
</head>
<body>
    <div id="app">
        <el-container>
            <el-header style="height: 70px">
                <el-card class="box-card" style="height: 65px">
                    <el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true" size="mini">
                        <el-form-item label="请选择职位分类" prop="_value" label-width="121px">
                            <div class="block">
                                <el-cascader v-model="form._value"
                                             :options="form._list"
                                             ref="cascaderAddr"
                                             @@change="adminSelect"></el-cascader>
                            </div>
                        </el-form-item>
                        <el-form-item label="职位选择" prop="_value">
                            <div class="block">
                                <el-cascader v-model="form._value1"
                                             :options="form._listd"
                                             ref="cascaderAddr1"
                                             style="width: 180px;"
                                             @@change="adminSelect1"></el-cascader>
                            </div>
                        </el-form-item>
                        <el-form-item prop="time" label="请选择登记时间"  label-width="110px">
                            <el-date-picker v-model="form.time"
                                            type="daterange"
                                            range-separator="至"
                                            format="yyyy 年 MM 月 dd 日"
                                            value-format="yyyy-MM-dd"
                                            start-placeholder="开始日期"
                                            end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                        <el-form-item>
                            <template>
                                <el-button type="primary" @@click="submitForm('form')">查询</el-button>
                            </template>
                        </el-form-item>
                    </el-form>
                    </el-card>
            </el-header>
            <el-main>
                <el-card class="box-card">
                    <el-table :data="list" style="width: 100%" border stripe>
                        <el-table-column prop="human_id"
                                         label="档案编号"
                                         align="center">
                            <template slot-scope="scope">
                                <el-button @@click="cz(scope.row)" type="text">{{scope.row.human_id}}</el-button>
                            </template>
                        </el-table-column>
                        <el-table-column prop="human_name"
                                         label="姓名"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="human_sex"
                                         label="性别"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="first_kind_name"
                                         label="I级机构"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="second_kind_name"
                                         label="II级机构"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="third_kind_name"
                                         label="III级机构"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="human_major_kind_name"
                                         label="职位分类"
                                         align="center">
                        </el-table-column>
                        <el-table-column prop="hunma_major_name"
                                         label="职位名称"
                                         align="center">
                        </el-table-column>
                    </el-table>

                    <el-row>
                        <el-col :span="1">
                            <el-pagination v-on:size-change="handleSizeChange"
                                           v-on:current-change="handleCurrentChange"
                                           :current-page="queryinfo.currentPage"
                                           :page-sizes="[1, 2, 3, 4]"
                                           :page-size="queryinfo.pageSize"
                                           layout="total, sizes, prev, pager, next, jumper"
                                           :total="total">
                            </el-pagination>
                        </el-col>
                    </el-row>
                    </el-card>
            </el-main>
        </el-container>
    </div>
    <script type="text/javascript">
    var vm = new Vue({
        el: "#app",
        data: {
            list: [],//人力资源
            queryinfo: {
                currentPage: 1,//当前页
                pageSize: 3//总页数
            },
            total: 1,//总条数
            form: {
                _value: [],
                _value1: [],
                time: '',
                _list: [],
                first_kind_id: '',
                first_kind_name: '',
                second_kind_id: '',
                second_kind_name: '',
                third_kind_id: '',
                third_kind_name: '',
                _listd: [],
                human_major_kind_id: '',
                human_major_kind_name: '',
                human_major_id: '',
                hunma_major_name: '',

            },
            rules: {
                _value: [
                    { required: true, message: '请选择机构', trigger: 'change' }
                ],
                _value1: [
                    { required: true, message: '请选择职位', trigger: 'change' }
                ]
            }
            },
        methods: {
            submitForm(formName) {
                //表单验证
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        //人力资源通过模糊查询
                        axios.get('/human_fileFo/QuerG0', {
                            params: {
                                first_kind_name: this.form.first_kind_name,
                                second_kind_name: this.form.second_kind_name,
                                third_kind_name: this.form.third_kind_name,
                                human_major_kind_name: this.form.human_major_kind_name,
                                hunma_major_name: this.form.hunma_major_name,
                                regist_time: this.form.time[0],
                                check_time: this.form.time[1],
                                currentPage: this.queryinfo.currentPage,
                                pageSize: this.queryinfo.pageSize
                            }
                        })
                            .then(res => {
                                console.info(res);
                                this.list = res.data.Data;
                                this.total = res.data.Row;
                            })
                            .catch(err => {
                                console.info(err);
                            });
                    } else {
                        this.$message({
                            type: 'error',
                            message: '请填写完整信息!'
                        });
                        return false;
                    }
                });
            },
                cz(row) {
                    location.href = "/human_fileFo/human_fileFoDelt/" + row.huf_id;
                },
            fill() {
                    //人力资源通过查询
                    axios.get('/human_fileFo/QuerF', {
                        params: {
                            currentPage: this.queryinfo.currentPage,
                            pageSize: this.queryinfo.pageSize
                        }
                    })
                        .then(res => {
                            console.info(res);
                            this.list = res.data.Data;
                            this.total = res.data.Row;
                        })
                        .catch(err => {
                            console.info(err);
                        });
                //机构查询
                    axios.get('/engage_major_release/Dg', {
                    })
                        .then(res => {
                            console.info(res);
                            this.form._list = res.data;
                        })
                        .catch(err => {
                            console.info(err);
                        });
                //职位查询
                    axios.get('/engage_major_release/Dgto', {
                    })
                        .then(res => {
                            console.info(res);
                            this.form._listd = res.data;
                        })
                        .catch(err => {
                            console.info(err);
                        });
            },
            //分页总页数改变事件
                handleSizeChange(val) {
                    this.queryinfo.pageSize = val;
                    this.fill();
            },
                 //分页当前页改变事件
                handleCurrentChange(val) {
                    this.queryinfo.currentPage = val;
                    this.fill();
                },
            adminSelect(value, thsAreaCode) {
                //获取组件名为cascaderAddr的选中节点的labe,path获取labe数组
                var thsAreaCode = this.$refs.cascaderAddr.getCheckedNodes()[0].pathLabels;
                var forminsert = value;
                this.form.first_kind_id = forminsert[0];
                this.form.second_kind_id = forminsert[1];
                this.form.third_kind_id = forminsert[2];
                this.form.first_kind_name = thsAreaCode[0];
                this.form.second_kind_name = thsAreaCode[1];
                this.form.third_kind_name = thsAreaCode[2];
            },
            adminSelect1(value, thsAreaCode) {
                var thsAreaCode = this.$refs.cascaderAddr1.getCheckedNodes()[0].pathLabels;
                var forminsert = value;
                this.form.human_major_kind_id = forminsert[0];
                this.form.human_major_id = forminsert[1];
                this.form.human_major_kind_name = thsAreaCode[0];
                this.form.hunma_major_name = thsAreaCode[1];
            },
        },
         //可以对vue的数据和方法进行操作,不能对DOM进行操作
            created: function () {
                this.fill();
            }
        });
    </script>
    <style scoped>

        element.style {
            height: 100%;
            width: 1239px;
        }

        .el-button.is-circle {
            border-radius: 50%;
            padding: 12px;
            position: relative;
            top: -10px;
            right: -570px;
        }
    </style>
</body>
</html>
